<style lang="less">
	/*@import './international.less';*/
</style>

<template>
	<div>
		<Row :gutter="8">

			<Col span="1" v-for="button in buttons" :key="button.sn">
			<Button @click="button.click(button)" :type="buttonType(button)">{{ button.text }}</Button>
			</Col>
			<slot>

			</slot>
		</Row>
	</div>
</template>

<script>
    //	按钮权限
    export default {
        data () {
            return {
                name: 'toolbar'
            }
        },
        methods: {
            buttonType(button){
                button = button || {};
                if (button.sn === "add") {
                    return "primary";
                }
                if (button.sn === "delete") {
                    return "error";
                }
                if (button.sn === "edit") {
                    return "text";
                }
                if (button.sn === "detail") {
                    return "text";
                }
                return "default";
            }
        },
        props: {
            menuSn: { // 加载菜单对应的按钮时候要用
                type: String
            },
            buttons: {
                type: Array
            }
        },
        mounted() {
        }
    }
</script>